package com.t2two.example.test;

import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @version 1.0
 * @description: 审批环节映射，因为专家评审或综合论证驳回后，还需要显示专家评审或综合论证环节，故此处做映射
 * @author: lifei
 * @date: 2024/6/7 16:28
 */
public enum FamousTeachersMappingEnum {

    work_unit_approve("Activity_1k5zu7o","work_unit_approve","单位资格审查"),
    county_approve("Activity_0fgp7re","county_approve","县（市、区）教育行政主管部门资格审查"),
    city_approve("Activity_0xxyt7j","city_approve","市教育和体育局资格复审"),
    expert_review("Activity_1h62t7k","expert_review","专家评审"),
    comprehensive_demonstration("Activity_0gzzn4p","comprehensive_demonstration","综合论证"),
    approval_publicity("Activity_0h7gig6","approval_publicity","审批公示"),
    finish("finish","finish","流程结束"),
    ;

    // 流程中的编号Id
    private String activityId;

    private String key;

    private String remark;

    FamousTeachersMappingEnum(String activityId, String key, String remark){
        this.activityId = activityId;
        this.key = key;
        this.remark = remark;
    }

    public static FamousTeachersMappingEnum getFamousTeachersMappingByActivityId(String activityId){
        if(StringUtils.isBlank(activityId)){
            return null;
        }
        for (FamousTeachersMappingEnum mappingEnum:FamousTeachersMappingEnum.values()) {
            if(mappingEnum.getActivityId().equals(activityId)){
                return mappingEnum;
            }
        }
        return null;
    }

    public static String getFamousTeachersRemarkByKey(String key){
        if(StringUtils.isBlank(key)){
            return null;
        }
        for (FamousTeachersMappingEnum mappingEnum:FamousTeachersMappingEnum.values()) {
            if(mappingEnum.getKey().equals(key)){
                return mappingEnum.getRemark();
            }
        }
        return null;
    }

    public static List<String> getKeyByVagueRemark(String vagueRemark){
        if(StringUtils.isBlank(vagueRemark)){
            return Collections.EMPTY_LIST;
        }
        List<String> stringList = new ArrayList<>();
        for (FamousTeachersMappingEnum mappingEnum:FamousTeachersMappingEnum.values()) {
            if(mappingEnum.getRemark().contains(vagueRemark)){
                stringList.add(mappingEnum.getKey());
            }
        }
        return stringList;
    }
    public String getActivityId() {
        return activityId;
    }

    public void setActivityId(String activityId) {
        this.activityId = activityId;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }
}
